package org.tzw.template.utils;

public class StopWatch {
    private Long startTime = 0L;
    private Long endTime = 0L;

    public Long resTime = 0L;

    public void start(){
        startTime = 0L;
        endTime = 0L;
        resTime = 0L;
        startTime = System.currentTimeMillis();
    }

    public void end(){
        if(startTime < 1&&endTime < 1){
            return;
        }
        endTime = System.currentTimeMillis();
        resTime = endTime - startTime;
        endTime = 0L;
    }

    public String getTotalMills(){
        return resTime+"ms";
    }

    public String getTotalSecond(){
        return String.format("%.1fs",resTime / 1000D);
    }


}
